package com.bro.person.admin.utils;

import com.bro.person.admin.model.AdminUser;
import com.bro.person.admin.struct.SecurityAuthenticateResultStruct;

/**
 *
 * 判断实体类是否有效 类!=null && 类.id!=null
 *
 * @author swallow
 * Created by swallow on 2018/10/12.<br>
 */
public class ValidateModelUtil {

    /**
     * 验证实体类的有效性
     * @param adminUser 用户信息实体类
     * @return flag 如果为false 标识无效的实体类 反之。。。
     */
    public static boolean isAdminUserValid(AdminUser adminUser){
        boolean flag = false;
        if(adminUser!=null && adminUser.getId()!=null){
            flag = true;
        }
        return flag;
    }

    /**
     * 验证返回权限对象结构的有效性
     * @param securityAuthenticateResultStruct
     * @return
     */
    public static boolean isSecurityModelValid(SecurityAuthenticateResultStruct securityAuthenticateResultStruct){
        boolean flag = false;
        if(securityAuthenticateResultStruct!=null && securityAuthenticateResultStruct.getUser()!=null && securityAuthenticateResultStruct.getUser().getUserId()>0){
            flag = true;
        }
        return flag;
    }

}
